table.insert(itemActions,
	function(item, action)
		-- RARE amulets
		-- see: dir .. "readme.txt" for information regarding these variables
		local priority = 7
		local identify = true
		local dump = true

		if not (item.quality==ItemQuality.Rare and item.baseItem.code=="amu") then 
			return false
		elseif action == aPICK and (not item.flags.Identified or isGoodRareAmulet(item)) then
			return priority
		elseif action == aIDENT then
			return identify
		elseif action == aSELL and item.flags.Identified and not isGoodRareAmulet(item) then
			return true
		elseif action == aDUMP and item.flags.Identified and not isGoodRareAmulet(item) then
			return dump
		end

		return false
	end
)

function isGoodRareAmulet(item)
	-- still needs work/testing
	local points = 0
	local fcr, sk, sktab = 0, 0, 0
	local stat, hp, mp, ll, ml = 0, 0, 0, 0, 0
	
	if hasRes(item, 15, 4) then
		points = 4
	elseif points == 0 and hasRes(item, 20, 3) then
		points = 4
	elseif points == 0 and hasRes(item, 25, 2) then
		points = 2
	elseif points == 0 and hasRes(item, 30, 1) then
		points = 1
	end
	
	for i = 0, item.mods:size() - 1 do
		if item.mods[i].Stat.Type == StatType.FasterCastRate then
			fcr = 1
		elseif item.mods[i].Stat.Type == StatType.ClassSkillsBonus and
				item.mods[i].Value == 2 then -- 2sk
			sk = 1
		elseif  item.mods[i].Stat.Type == StatType.SkillTabBonus and
				item.mods[i].Value == 2 then --  2sktab
			sktab = 1
		elseif (item.mods[i].Stat.Type == StatType.Strength or
				item.mods[i].Stat.Type == StatType.Dexterity or
				item.mods[i].Stat.Type == StatType.Energy) and
				item.mods[i].Value >= 16 then -- 16+str/dex/eng
			stat = 1
		elseif item.mods[i].Stat.Type == StatType.MaxLife and
				item.mods[i].Value >= 41 then -- 41+hp
			hp = 1
		elseif item.mods[i].Stat.Type == StatType.MaxMana and
				item.mods[i].Value >= 61 then -- 61+mp
			mp = 1
		elseif item.mods[i].Stat.Type == StatType.LifeDrainMinDamage and
				item.mods[i].Value >= 6 then -- 6+ll
			ll = 1
		elseif item.mods[i].Stat.Type == StatType.ManaDrainMinDamage and
				item.mods[i].Value >= 6 then -- 6+ml
			ml = 1
		end
	end

	--[[
	points
	30+sres: 1
	25+dres: 2
	20+tres: 4
	15+ares: 4

	fcr: 4
	sk/sktab: 4
	15+stat: 3
	41+hp: 3
	61+mp: 2
	6+ll: 0.5
	6+ml: 0.5
	ll+ml: 2
	]]--
	
	if (ll + ml) == 2 then
		points = points + 2
	else
		points = points + 0.5*(ll + ml)
	end

	points = points + 4*(fcr + sk + sktab) + 3*(stat + hp) + 2*mp
	
	return (points >= 9)
end

--[[
	high end mods
	prefix
	mp 61-90
	singleres 31-40
	allres 16-20
	sk 2
	sktab 2
	
	suffix
	str 21-30
	dex 16-20
	eng 16-20
	hp 41-60
	ll 6-9
	ml 6-9
	fcr 10
]]--

--[[
	below: ilikebigtits' rare amulet func
	not sure which is best way to adjust threshold
	just know that it kept a junk hp+mp ammy
	added init q, that could have been the problem
	but I dont have time/amulets to test it

	feel free to use/modify/try to get this to work
	just make sure to uncomment his and then
	comment the above one in the same fasion
]]--

--[[
function isGoodRareAmulet(item)
	local q = 0
	local sk, allsk, fcr = false, false, false
	local str, dex, mana, life = 0, 0, 0, 0
	
	for i = 0, item.mods:size() - 1 do
		if (item.mods[i].Stat.Type == StatType.FasterCastRate) then
			fcr = true
		elseif item.mods[i].Stat.Type == StatType.ClassSkillsBonus and item.mods[i].Value == 2 then
			allsk = true
		elseif item.mods[i].Stat.Type == StatType.SkillTabBonus and item.mods[i].Value == 2 then
			sk = true
		elseif item.mods[i].Stat.Type == StatType.Strength then
			str= item.mods[i].Value 
		elseif item.mods[i].Stat.Type == StatType.Dexterity then
			dex= item.mods[i].Value 
		elseif item.mods[i].Stat.Type == StatType.MaxLife then
			life= item.mods[i].Value 
		elseif item.mods[i].Stat.Type == StatType.MaxMana then
			mana= item.mods[i].Value 
		end
	end
	
	res=countAllres(item)

	q = life*3 + mana*2 + str*4 + dex*4 + res.Sum
	
	if fcr then
		q=q+180
	end
	if sk then
		q=q+180
	end
	if allsk then
		q=q+300
	end

	--
	-- needs to be tested and threshold adjusted
	--
	return (
			--allsk and (fcr or (str+dex>=25) or (life+mana >= 50)) or
			--sk and fcr and ((str+dex>=20) or (life+mana >= 40))
			q > 480
			)
end
]]--